package net.mukia.repository.impl.hibernate;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import net.mukia.model.Content;
import net.mukia.repository.ContentRepository;

@Repository("contentRepository")
public class HibernateContentRepository extends BaseRepository<Content> implements ContentRepository {

	
	@SuppressWarnings("unchecked")
	public List<Content> selectAll(Content content){
		Criteria creiteria = getSession()
				.createCriteria(Content.class)
				.add(Restrictions.eq("chapter.id", content.getChapter().getId()));
		return ((List<Content>) creiteria.list());
	}

}
